package com.alter.zhang.userprovider.config.log;

import ch.qos.logback.classic.pattern.ClassicConverter;
import ch.qos.logback.classic.spi.ILoggingEvent;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class LocalIPConfig extends ClassicConverter {
    @Override
    public String convert(ILoggingEvent event) {
        try {
            // 获取主机IP
            return InetAddress.getLocalHost().getHostAddress();
        } catch (UnknownHostException e) {
        }
        return null;

    }
}
